﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SampleCard.aspx.cs" Inherits="PPAP.Web.Part.SampleCard" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif;overflow-x:auto;">
    <form id="form1" runat="server">
    <div>
        <table width="900px">
            <tr>
                <td align="right">
                    <input type="button" onclick="javascript:add()" id="btnAdd" runat="server" class="button"
                        value="Add" />
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    <asp:GridView ID="GridView1" runat="server" CellPadding="4" Width="100%" ForeColor="#333333"
                        GridLines="None" AutoGenerateColumns="False">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="SN"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%#Eval("rownum") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Sample card No."  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <a href="#" style="color:Blue;" onclick="check(<%#Eval("ID") %>)"><asp:Label ID="Label2" runat="server" Text='<%#Eval("SAMPLECARDNO").ToString()==""?"":"SC-"+Eval("SAMPLECARDNO") %>'></asp:Label></a>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Width="100px"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Department"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%#Eval("testitemname") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Contact person"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%#Eval("firstname")+" "+Eval("familyname") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Status"   ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label5" runat="server" Text='<%#Status(Eval("STATUS").ToString()) %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Result"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Image ID="Image1" Visible='<%#Eval("RESULT").ToString()==""?false:true %>' ImageUrl='<%#"~/Part/image/"+Eval("RESULT")+".png" %>'
                                        runat="server" />
                                    <asp:Label ID="Label6" runat="server" Text='<%#Eval("RESULT").ToString()==""?"":Eval("RESULT").ToString()=="G"?"approved":Eval("RESULT").ToString()=="R"?"refused":Eval("RESULT").ToString()=="Y"?"conditionally approved":"" %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Start time"   ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label7" runat="server" Text='<%#Eval("STARTTIME").ToString()==""?"":DateTime.Parse(Eval("STARTTIME").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="End time（planned）"   ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label8" runat="server" Text='<%#Eval("ENDTIMEPLAN").ToString()==""?"":DateTime.Parse(Eval("ENDTIMEPLAN").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="End time （actual）"   ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:Label ID="Label9" runat="server" Text='<%#Eval("ENDTIMEACTUAL").ToString()==""?"":DateTime.Parse(Eval("ENDTIMEACTUAL").ToString())>DateTime.Parse("1900-02-01")?DateTime.Parse(Eval("ENDTIMEACTUAL").ToString()).ToString("yyyy-MM-dd"):""  %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Action"  ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" >
                                <ItemTemplate>
                                    <asp:ImageButton ID="ImageButton1" ToolTip="Print" PostBackUrl='<%#"javascript:print("+Eval("ID")+")" %>'
                                        Visible='<%#Eval("Status").ToString()=="9"?false:true %>' Width="22" ImageUrl="../Images/newimg/printer.png"
                                        runat="server" />
                                    <img id="imgT" runat="server" onclick='<%#"javascript:del("+Eval("ID")+")" %>' src="~/Images/newimg/delete.png"
                                        visible='<%#Eval("Status").ToString()=="9"?false:true %>' title="Terminated" />
                                    <img id="imgE" runat="server" onclick='<%#"javascript:edit("+Eval("TESTDEPARTMENTID")+","+Eval("ID")+")" %>'
                                        src="~/Images/newimg/write.png" visible='<%#Eval("Status").ToString()=="0"?true:false %>'
                                        title="Edit" />
                                        <asp:ImageButton ID="ImageButton2" ToolTip="Log file" ImageUrl="../Images/newimg/search.png"
                                        runat="server" PostBackUrl='<%#"javascript:show("+Eval("ID")+")" %>' />
                                        <img id="imgR" runat="server" onclick='<%#"javascript:edit("+Eval("TESTDEPARTMENTID")+","+Eval("ID")+")" %>'
                                        src="~/Images/newimg/write.png" visible='<%#Eval("issendmail").ToString()=="9"?true:false %>'
                                        title="re-inpsection" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" Wrap="false"></ItemStyle>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2E8AC5" />
                        <FooterStyle BackColor="#507CD1" ForeColor="White" />
                        <HeaderStyle BackColor="#E7E8E8" ForeColor="#000000" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Left" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </td>
            </tr>
            <tr runat="server" id="tr" visible="false">
                <td>
                    <hr />
                    <table style="margin-top: 10px;" width="100%">
                        <tr>
                            <td style="font-weight: bold; color: #2E8AC5;">
                                Remark
                            </td>
                        </tr>
                        <tr style="height: 28px;">
                            <td>
                                <img src="image/G.png" alt="" style=" vertical-align: middle;" />&nbsp;GREEN - 
                                approved
                            </td>
                        </tr>
                        <tr style="height: 28px;">
                            <td>
                                <img src="image/Y.png" alt="" style=" vertical-align: middle;" />&nbsp;YELLOW - 
                                conditionally approved</td>
                        </tr>
                        <tr style="height: 28px;">
                            <td>
                                <img src="image/R.png" alt="" style=" vertical-align: middle;" />&nbsp;RED - refused
                            </td>
                        </tr>
                    </table>
                    <hr />
                </td>
            </tr>
        </table>
    </div>
    <script language="javascript" type="text/javascript">
        function add() {
            url = "SampleCardAdd.aspx?rid=<%=RID %>";
            PopUpWindow(url, 230, 160, 730, 520);
        }
        function edit(id, sid) {
            url = "SampleCardAdd.aspx?rid=<%=RID %>&id=" + id+"&sid="+sid;
            PopUpWindow(url, 230, 160, 730, 520);
        }
        function show(id) {
            url = "SampleCardLog.aspx?sid=" + id;
            PopUpWindow(url, 230, 160, 730, 520);
        }
        function print(id) {
            url = "SampleCardPrint.aspx?id=" + id;
//            PopUpWindow(url, 230, 0, 830, 700);
            open(url, 'newwindow', 'height=720,width=910,top=0,left=230,toolbar=yes,menubar=yes,scrollbars=yes,resizable=no,location=no,status=no');
        }
        function del(id) {
            if (confirm('Are you sure you want to Terminated?')) {
                url = "SampleCard.aspx?rid=<%=RID %>&sid=" + id;
                window.location.href = url;
            }
        }

        function check(id) {
            url = "../todolist/SampleCardWeb.aspx?rid=<%=RID %>&his=1&sid=" + id;
            PopUpWindow(url, 230, 0, 950, 700);
        }
    </script>
    </form>
</body>
</html>
